{extend name="common/common" /}

{block name="content"}
	<div class="ibox-title">
	    <h5>映潮指数月报表</h5>
	</div>
	<div class="ibox-content">
		<div id="table-box">
			<el-form :inline="true" class="search-table-form">
				<el-form-item>
					<el-date-picker
						v-model="sea.seaTime[0]"
						type="month"
						value-format="timestamp"
						placeholder="开始月份">
					</el-date-picker>
				</el-form-item>
				<el-form-item>
					<el-date-picker
						v-model="sea.seaTime[1]"
						type="month"
						value-format="timestamp"
						placeholder="结束月份">
					</el-date-picker>
				</el-form-item>
				<el-form-item>
					<el-input
						placeholder="请输入填报人"
						clearable="true"
						v-model="sea.seaLinkman">
					</el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="info" plain @click="getTable">查询</el-button>
				</el-form-item>
			</el-form>
			<el-table :data="tableData" stripe="true" border>
				<el-table-column align="center" prop="id" sortable width="80"
					label="序号">
				</el-table-column>
				<el-table-column align="center" prop="rpt_date" sortable
					label="报表日期">
				</el-table-column>
				<el-table-column align="center" prop="link_man" label="填报人"></el-table-column>
				<el-table-column align="center" prop="link_type" label="联系电话"></el-table-column>
				<el-table-column align="center" prop="operate" label="操作" width="200">
					<template slot-scope="scope">
						{if authCheck('icdata/edittable_all_county')}
						<el-tooltip content="编辑" open-delay="500" hide-after="1500" placement="bottom">
						<el-button circle
							@click="editRow(scope.row)"
							size="mini" plain 	type="success"
							icon="el-icon-edit-outline">
						</el-button>
						</el-tooltip>
						{/if}
						{if authCheck('icdata/deltable_all_county')}
						<el-tooltip content="删除" open-delay="500" hide-after="1500" placement="bottom">
						<el-button circle
							@click="delRow(scope.row)"
							size="mini" plain 	type="danger"
							icon="el-icon-delete">
						</el-button>
						</el-tooltip>
						{/if}
						{if authCheck('icdata/seetable_all_county')}
						<el-tooltip content="查看" open-delay="500" hide-after="1500" placement="bottom">
						<el-button circle
							@click="seeRow(scope.row)"
							size="mini" plain type="primary"
							icon="fa fa-eye">
						</el-button>
						</el-tooltip>
						{/if}
					</template>
				</el-table-column>
			</el-table>
			<div class="table-page">
				<el-pagination
					@size-change="pageSizeChange"
					@current-change="curPageChange"
					:current-page="sea.pageNumber"
					:page-sizes="[10, 20, 50, 75]"
					:page-size="sea.pageSize"
					layout="total, sizes, prev, pager, next, jumper"
					:total="tableTotal">
				</el-pagination>
			</div>
		</div>
	</div>
{/block}

{block name="script"}
<script type="text/javascript">
var main =  new Vue({
	el:"#main",
	data() {
		return {
			loading:false,
			sea:{
				seaDepart:"",
				seaTime:{0:"",1:""},
				seaLinkman:"",
				pageSize:10,
				pageNumber:1
			},
			tableData:'',
			tableTotal:0
		}
	},
	mounted:function(){
		this.getTable();
	},
	methods:{
		getTable(){
			this.loading=true;
			var param = this.sea;
			$.post('{:url("Icdata/list_all_county")}',param,function(res){
				main.loading=false;
				if(res.code == 1){
					main.$message({
			          message: res.msg,
			          type: 'success'
			        });
					main.tableData = res.data.rows;
					main.tableTotal = res.data.total;
				}else{
					main.$notify.error({
						title: '失败',
						message: res.msg,
					});
				}
			})
		},
		pageSizeChange(val) {
			this.sea.pageSize = val;
			this.getTable();
		},
		curPageChange(val) {
			this.sea.pageNumber = val;
			this.getTable();
		},
		seeRow(row) {
			window.location.href = "{:url('Icdata/edittable_all_county')}?id="+row.id;
		},
		editRow(row){
			window.location.href = "{:url('Icdata/edittable_all_county')}?id="+row.id;
		},
		delRow(row){
			this.$confirm('此操作将永久删除该报表, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				$.post('{:url("Icdata/deltable_all_county")}',{id:row.id},function(res){
					if(res.code == '1'){
						main.$notify({title:"成功",type:"success",message:res.msg});
						main.getTable();
					}else{
						main.$notify.error({title:"错误",message:res.msg})
					}
				})
			}).catch(() => {
				this.$notify.info({title: '消息',message: '已取消删除'});
			});
		},
	}
})
</script>
{/block}
